﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HgCo.WindowsLive.SkyDrive;
using API.WindowsLive.SkyDrive;

namespace Simple
{
    class Program
    {
        static void Main(string[] args)
        {

            Dictionary<String, String> dico = SkyDriveSynchronizerStarter.GetUserNameAndPassword();
            SkyDriveWebClient skyDrive = new SkyDriveWebClient();

            try
            {
                skyDrive.LogOn(dico["username"], dico["password"]);
            }
            catch (Exception ex)
            {
            }

            try
            {
                Read(skyDrive);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        private static void Read(SkyDriveWebClient skyDrive)
        {
            WebFolderInfo[] webFolders = skyDrive.ListRootWebFolders();
            foreach (WebFolderInfo webFolder in webFolders)
            {
                if (webFolder.Name.Equals("TestFolder"))
                {
                    WebFolderInfo retrievedWebFolder = skyDrive.GetWebFolder(webFolder);
                    WebFileInfo[] webFiles = skyDrive.ListSubWebFolderFiles(retrievedWebFolder);
                        //retrievedWebFolder.GetFiles();

                    foreach (WebFileInfo webFile in webFiles)
                    {
                        if (webFile.FullName.Equals("TestFileMissing.txt"))
                        {

                        }
                    }

                }
            }
        }
    }
}
